//
//  UIView+NetResultView.h
//  AirTraffic
//
//  Created by yby on 2019/9/19.
//  Copyright © 2019 天九网络科技. All rights reserved.
//

#import <UIKit/UIKit.h>
@class HTLoadingPageView;
@class HTEmptyControlView;

typedef NS_ENUM(NSUInteger, HTEmptyButtonType) {
    HTEmptyButtonTypeHidden,
    HTEmptyButtonTypeReload,
    HTEmptyButtonTypeBack,
    HTEmptyButtonTypePush
};
typedef NS_ENUM(NSUInteger, HTEmptyImageType) {
    HTEmptyImageTypeNetBad,
    HTEmptyImageTypeNoData
};


@interface UIView (NetResultView)
/// 配置按钮回调
- (void)wb_configReloadAction:(void (^)(void))block;
- (void)wb_configBackAction:(void (^)(void))block;
- (void)wb_configPushAction:(void (^)(void))block;
/// 配置按钮颜色、文案
- (void)wb_configControlButtonColor:(UIColor *)color;
- (void)wb_configControlButtonTitle:(NSString *)title;
/// 找到当前controller
- (UIViewController *)wb_viewController;


///空视图（TJEmptyControlView）
@property (nonatomic,strong) HTEmptyControlView *var_emptyControlView;
@property (nonatomic, assign) HTEmptyButtonType var_buttonType;

/// 图片类型、文字、按钮类型
/// @param frame 空视图Frame
/// @param isFull 是否与当前控件大小相同
/// @param imageType 图片类型（无数据、无网络）
/// @param titleName 可自定义描述文字
/// @param buttonType 按钮类型（隐藏、刷新、返回、Push）
- (void)wb_showEmptyControlViewWitnFrame:(CGRect)frame
                        fullScreen:(BOOL)isFull
                            imageType:(HTEmptyImageType)imageType
                            titleName:(NSString *)titleName
                           buttonType:(HTEmptyButtonType)buttonType
                           buttonName:(NSString *)buttonName;

/// 自定义图片名、文字、按钮类型
/// @param frame 空视图Frame
/// @param isFull 是否与当前控件大小相同
/// @param imageName 可自定义图片展示
/// @param titleName 可自定义描述文字
/// @param buttonType 按钮类型（隐藏、刷新、返回、Push）
- (void)wb_showEmptyControlViewWitnFrame:(CGRect)frame
                        fullScreen:(BOOL)isFull
                            imageName:(NSString *)imageName
                            titleName:(NSString *)titleName
                           buttonType:(HTEmptyButtonType)buttonType
                           buttonName:(NSString *)buttonName;
/// 隐藏空数据页面
- (void)wb_hiddenEmptyControlView;

/// 加载指示器（TJLoadingPageView）
@property (nonatomic,strong) HTLoadingPageView *var_loadingView;
- (void)wb_beginLoading;
- (void)wb_endLoading;

@end



#pragma mark - TJEmptyControlView
@interface HTEmptyControlView : UIView
@property (nonatomic,weak) UIImageView *var_imageView;
@property (nonatomic,weak) UILabel *var_tipLabel;
@property (nonatomic, weak) UIButton *var_controlButton;
@property (nonatomic,copy) void(^didClickReloadBlock)(void);
@property (nonatomic,copy) void(^didClickBackBlock)(void);
@property (nonatomic,copy) void(^didClickPushBlock)(void);
- (instancetype)initWithFrame:(CGRect)frame buttonType:(HTEmptyButtonType)buttonType;
@end

#pragma mark - TJLoadingPageView
@interface HTLoadingPageView : UIView
- (void)wb_startAnimation;
- (void)wb_stopAnimation;
@end



